package com.xvyy.tingshu.user.client;

import com.xvyy.tingshu.common.result.Result;
import com.xvyy.tingshu.model.user.UserInfo;
import com.xvyy.tingshu.user.client.impl.UserInfoDegradeFeignClient;
import com.xvyy.tingshu.vo.user.UserInfoVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * @author qy
 */
@FeignClient(
        path = "/api/rpc/userinfo",
        contextId = "userInfoFeignClient",
        value = "service-user",
        fallback = UserInfoDegradeFeignClient.class)
public interface UserInfoFeignClient {


    /**
     * 远调查询用户微服务获取用户的基本信息
     *
     * @param userId
     * @return
     */
    @GetMapping("/getUserinfo/{userId}")
    Result<UserInfoVo> getUserInfoVo(@PathVariable(value = "userId") Long userId);

    /**
     * 获取该购买专辑下的声音列表
     *
     * @param userId
     * @param albumId
     * @return
     */
    @GetMapping("/getUserPaidAlbumTrackList/{userId}/{albumId}")
    Result<Map<Long, String>> getUserPaidAlbumTrackList(@PathVariable(value = "userId") Long userId, @PathVariable(value = "albumId") Long albumId);

    /**
     * 获取登录用户购买整张专辑信息
     *
     * @param userId
     * @param albumId
     * @return
     */
    @GetMapping("/getUserPaidAlbum/{userId}/{albumId}")
    Result<Boolean> getUserPaidAlbum(@PathVariable(value = "userId") Long userId, @PathVariable(value = "albumId") Long albumId);

    @GetMapping(value = "/updateUserVip/")
    Result<UserInfo> updateUserVip(@RequestBody UserInfo userInfo);

    @GetMapping(value = "/updateVipExpireStatus/")
    Result updateVipExpireStatus();
}